<!DOCTYPE html>
<html lang="zh" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('结算列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <p>订单编号：</p>
                            <input name="orderSn" type="text"/>
                        </li>
                        <li class="select-time">
                            <p>对账状态：</p>
                            <select name="account" heigh="80px">
                                <option>全部账单</option>
                                <option>待确认</option>
                                <option>已确认</option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="mall:order:export">-->
                <!--<i class="fa fa-download"></i> 导出-->
            <!--</a>-->
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table data-mobile-responsive="true" id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('mall:order:edit')}]];
    var removeFlag = [[${@permission.hasPermi('mall:order:remove')}]];
    var prefix = ctx + "finance/financeSettlement";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            detailUrl: prefix + "/detail",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "订单",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '序号',
                    visible: false
                },
                {
                    field: 'storeId',
                    title: '商家ID'
                },
                {
                    field: 'settlementSn',
                    title: '结算编号'
                },
                {
                    field: 'name',
                    title: '对账单'
                },
                {
                    field: 'startTime',
                    title: '结算开始时间'
                },
                {
                    field: 'endTime',
                    title: '结算结束时间'
                },
                {
                    title: '结算状态',
                    formatter: function (value, row, index) {
                        if (row.status == 0) {
                            return "待确认";
                        }
                        if (row.status == 1) {
                            return "已确认";
                        }
                    }
                },
                {
                    field: 'totalAmount',
                    title: '结算金额'
                },
                {
                    field: 'createTime',
                    title: '账单生成时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="detailUrl(\'' + row.id + '\')">账单明细</a>');
                        // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="detailUrl(\'' + row.id + '\')">发送账单</a>');
                        return actions.join('');
                    }
                }
            ]
        };
        $.table.init(options);
    });

    function detailUrl(id) {
        console.log(id)
        $.modal.open("对账单详情", ctx + "finance/financeCheck/checkAccountDetail?settlementId=" + id);
    }
</script>
</body>
</html>
